﻿CREATE PROCEDURE [dbo].[wikiPages_insert]
    @wikiCategoryId int,
    @pageName nvarchar(256),
    @content nvarchar(max),
    @creationDate datetime2,
    @publicUrl nvarchar(256)
AS
    INSERT INTO WikiPages
    (
        CategoryId,
        Name,
        Content,
        CreationDate,
        PublicUrl
    )
    VALUES 
    (
        @wikiCategoryId,
        @pageName,
        @content,
        @creationDate,
        @publicUrl
    )
    
    DECLARE @wikiPageId int = @@IDENTITY 

    SELECT PageId, CategoryId, Name, Content, CreationDate, PublicUrl
    FROM WikiPages 
    WHERE WikiPages.PageId = @wikiPageId
RETURN 0
